<?php
require('includes/top.php');


$accessories = $_POST['accessories'];
$description = $_POST['description'];
$depot_location = $_POST['depot_location'];

$query = "SELECT * FROM accessories_data WHERE `accessories_name` = '".trim($accessories)."'";
$result = mysql_query($query);
if ( mysql_num_rows ( $result )> 0 )
{
    header("location: add_accessories?v=err");
}
else
 {
$sql1="INSERT INTO accessories_data(`accessories_name`,`description`) VALUES ('$accessories','$description')";
$result1=mysql_query($sql1);
}

if($result1>0)
{
header('Location: add_accessories.php?v=success');
}
else
{
header('Location: add_accessories.php?v=err');
}
?>